import cv2
def detectAndDescribe(image):
    gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
    sift=cv2.SIFT_create()
    kp,des=sift.detectAndCompute(gray,None)
    return image,kp,des
imgA=cv2.imread("left_01.jpg")
imgB=cv2.imread("right_01.jpg")
imgA,kpA,desA=detectAndDescribe(imgA)
imgB,kpB,desB=detectAndDescribe(imgB)
matcher=cv2.BFMatcher(cv2.NORM_L2)
rawMatches=matcher.match(desA,desB)
rawMatches=sorted(rawMatches,key=lambda x:x.distance)
out=cv2.drawMatches(imgA,kpA,imgB,kpB,rawMatches[:30],None)
cv2.imshow('drawMatches',out)
cv2.waitKey()
cv2.destroyAllWindows()